#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int main()
{
	int fd = 0;
	char buf[100] = {0};
	int ret = 0;

	fd = open("./pipe",O_WRONLY);
	if(fd == -1)
	{
		perror("open");
		exit(-1);
	}

	printf("please input a string:\n");
	scanf("%s",buf);

	while(1)
	{
	ret = write(fd,buf,strlen(buf));
	if(ret == -1)
	{
		perror("write");
		exit(-1);
	}

	}

	close(fd);

	return 0;
}
